//
//  AboutScene.m
//  jumpingfrog
//
//  Created by Tri Vo on 8/16/13.
//  Copyright 2013 Tri Vo. All rights reserved.
//

#import "AboutScene.h"
#import "GeneralDef.h"
#import "GameController.h"
#import "MenuScene.h"
#import "SceneManager.h"

@implementation AboutScene

+ (CCScene *) scene {
    CCScene *scene = [CCScene node];
    AboutScene *layer = [AboutScene node];
    [scene addChild:layer];
    return scene;
}

- (id) init {
    if (self = [super init]) {
        [self initScreen];
    }
    return self;
}

- (void)dealloc {
    [super dealloc];
}

#pragma mark - Scene Methods

- (void) initScreen {
    CGSize winSize = [GameController getWinSize];
    // Background
    CCSprite *pBackground = [CCSprite spriteWithFile:IMG_BACKGROUND];
    [pBackground setAnchorPoint:CGPointZero];
    [pBackground setPosition:CGPointZero];
    [self addChild:pBackground];
    
    // Title
    CCLabelTTF *pTitle = [CCLabelTTF labelWithString:STR_ABOUT fontName:FONT_TITLE fontSize:28];
    [pTitle setPosition:CGPointMake(winSize.width/2, winSize.height/2 + 125)];
    [self addChild:pTitle];
    
    // Powered
    CCLabelTTF *pLabelPower = [CCLabelTTF labelWithString:STR_POWERED_BY fontName:FONT_CONTENT fontSize:22];
    [pLabelPower setPosition:CGPointMake(winSize.width/2, winSize.height/2 + 80)];
    [self addChild:pLabelPower];
    
    // Cocos2d Logo
    CCSprite *pCocos2dLogo = [CCSprite spriteWithFile:IMG_COCOS_LOGO];
    [pCocos2dLogo setAnchorPoint:CGPointZero];
    [pCocos2dLogo setScale:0.1f];
    [pCocos2dLogo setPosition:CGPointMake(202, 131)];
    [self addChild:pCocos2dLogo];
    

    // Send feeback label
    CCLabelTTF *pLabelFeedback =  [CCLabelTTF labelWithString:STR_CONTACT_INFO fontName:FONT_CONTENT fontSize:22];
    [pLabelFeedback setPosition:CGPointMake(winSize.width/2, winSize.height/2 - 60)];
    [self addChild:pLabelFeedback];
    
    // Email
    CCLabelTTF *pLabelEmail = [CCLabelTTF labelWithString:STR_EMAIL fontName:FONT_CONTENT fontSize:18];
    [pLabelEmail setPosition:CGPointMake(winSize.width/2, winSize.height/2 - 80)];
    [self addChild:pLabelEmail];
    
    // Btn back
    CCMenuItemFont *pBtnBack = [CCMenuItemFont itemWithString:STR_BACK target:self selector:@selector(menuBack_Clicked)];
    // Menu
    CCMenu *pMenu = [CCMenu menuWithItems:pBtnBack, nil];
    [pMenu setPosition:CGPointMake(50, 30)];
    [self addChild:pMenu];
}

#pragma mark - Scene Actions

- (void) menuBack_Clicked {
    [[SceneManager getInstance] goMenu];
}

@end
